package appcus

import (
	"counter-help/admin/server/middleware"

	"github.com/gin-gonic/gin"
)

type CusOrderRouter struct{}

// InitCusOrderRouter 初始化 cusOrder表 路由信息
func (s *CusOrderRouter) InitCusOrderRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
	// TODO: PublicRouter改为Router
	cusOrderRouter := Router.Group("appcusOrder").Use(middleware.OperationRecord())
	cusOrderRouterWithoutRecord := Router.Group("appcusOrder")
	cusOrderRouterWithoutAuth := Router.Group("appcusOrder")
	publicRouter := PublicRouter.Group("appcusOrder")

	{
		cusOrderRouter.POST("createCusOrder", cusOrderApi.CreateCusOrder)                               // 新建cusOrder表
		cusOrderRouter.DELETE("deleteCusOrder/:ID", cusOrderApi.DeleteCusOrder)                         // 删除cusOrder表
		cusOrderRouter.DELETE("deleteCusOrderByIds", cusOrderApi.DeleteCusOrderByIds)                   // 批量删除cusOrder表
		cusOrderRouter.PUT("updateCusOrder", cusOrderApi.UpdateCusOrder)                                // 更新cusOrder表
		cusOrderRouter.GET("getAllCusOrders", cusOrderApi.GetAllCusOrders)                              // 获取所有订单
		cusOrderRouter.POST("getCusOrdersByUserID", cusOrderApi.GetCusOrdersByUserID)                   // 获取用户订单
		cusOrderRouter.POST("searchCusOrders", cusOrderApi.SearchCusOrders)                             // 搜索订单
		cusOrderRouter.POST("getCusOrdersByStatusAndIsPaid", cusOrderApi.GetCusOrdersByStatusAndIsPaid) // 获取特定状态的订单
		cusOrderRouter.POST("addOrderEvaluation", cusOrderApi.EvaluateCusOrder)                         // 添加订单评价
		cusOrderRouter.GET("getEvaluatedCusOrders", cusOrderApi.GetEvaluatedCusOrders)                  // 获取包含评价的订单
	}

	{
		cusOrderRouterWithoutRecord.GET("getCusOrderList", cusOrderApi.GetCusOrderList) // 获取cusOrder表列表
	}

	{
		cusOrderRouterWithoutAuth.GET("getCusOrderPublic", cusOrderApi.GetCusOrderPublic) // 获取公开的cusOrder表信息
	}
	{
		publicRouter.POST("filteredOrders", cusOrderApi.FilterCusOrders)         // 筛选订单
		publicRouter.POST("searchOrders", cusOrderApi.SearchOrders)              // 筛选订单
		publicRouter.GET("getOptimalCusOrders", cusOrderApi.GetOptimalCusOrders) // 获取所有订单
		publicRouter.GET("findCusOrder", cusOrderApi.FindCusOrder)               // 根据ID获取cusOrder表
	}
}
